﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using System.Data .SqlClient;

public partial class BaoMingBiao : System.Web.UI.Page
{
    private static string sqlconn = System.Configuration.ConfigurationManager.AppSettings["strConn"].ToString().Trim();
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            BindData();
        }
    }

    protected void BindData()
    {
        users us = new users();
        GridViewBaoMing.DataSource = us.GetAlluser(us);
        GridViewBaoMing.DataBind();
    }
    
    //protected void btnShaiXuan_Click(object sender, EventArgs e)
    //{
    //   /* SqlDataSource dbo = new SqlDataSource();
    //    var results = from r in dbo.kinder
    //                  where System.Data.Ling.SqlClient.SqlMethods.Like(r.area, "%%")
    //                  select r;
    //    GridViewBaoMing.DataSource = results;
    //    GridViewBaoMing.DataBind();*/
    //}
    //protected void GridViewBaoMing_RowUpdating(object sender, GridViewUpdateEventArgs e)
    //{
    //    string _k_name = GridViewBaoMing.DataKeys[e.RowIndex].Value.ToString().Trim();
    //    string _k_sex = ((TextBox)(GridViewBaoMing.Rows[e.RowIndex].Cells[1].Controls[0])).Text.Trim();
    //    string _k_birthday = ((TextBox)(GridViewBaoMing.Rows[e.RowIndex].Cells[2].Controls[0])).Text.Trim();
    //    string _k_phone = ((TextBox)(GridViewBaoMing.Rows[e.RowIndex].Cells[3].Controls[0])).Text.Trim();
    //    string _k_area = ((TextBox)(GridViewBaoMing.Rows[e.RowIndex].Cells[4].Controls[0])).Text.Trim();
    //    string _k_street = ((TextBox)(GridViewBaoMing.Rows[e.RowIndex].Cells[5].Controls[0])).Text.Trim();
    //    string _k_address = ((TextBox)(GridViewBaoMing.Rows[e.RowIndex].Cells[6].Controls[0])).Text.Trim();

    //    users tmp = new users();
    //    tmp.k_name  = _k_name;
    //    tmp.k_sex = _k_sex;
    //    tmp.k_birthday  =_k_birthday ;
    //    tmp.k_phone = _k_phone; 
    //    tmp.k_area  =_k_area ;
    //    tmp.k_street  =_k_street ;
    //    tmp.k_address = _k_address;
    //    tmp.gx(tmp);

    //    GridViewBaoMing.EditIndex = -1;
    //    BindData();
    //}
    protected void btnFaSong_Click(object sender, EventArgs e)
    {
        Response.Write("<script>alert(\"已成功发送给招生部！\")</script>");
    }
    protected void GridViewBaoMing_RowDeleting(object sender, GridViewDeleteEventArgs e)
    {
        string id = GridViewBaoMing.DataKeys[e.RowIndex].Value.ToString().Trim();

        users us = new users();
        us.k_id  =id ;
        us.Sub_Delete(us);
        BindData();
    }
    protected void GridViewBaoMing_RowDataBound(object sender, GridViewRowEventArgs e)
    {
        users us = new users();
        if (e.Row.RowType == DataControlRowType.DataRow)
        {
            if (e.Row.RowIndex == GridViewBaoMing.EditIndex)
            {
                DataRowView rowItem = (DataRowView)e.Row.DataItem;

            }
        }
            try
            {
                //获取删除按钮
                LinkButton lnkbtnDelete = (LinkButton)e.Row.Cells[8].Controls[0];
                //实现客户端信息显示
                lnkbtnDelete.OnClientClick = "return confirm('你真的要删除" + e.Row.Cells[1].Text + "吗？');";
            }
            catch
            { }
      }
    
}